package com.flyduck.mall.pms.h5.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.flyduck.mall.pms.h5.service.H5ProductService;
import com.flyduck.ss.common.core.domain.R;
import com.flyduck.mall.common.web.core.BaseController;
import com.flyduck.mall.pms.h5.vo.H5ProductDetailsRespVO;
import com.flyduck.mall.pms.h5.vo.H5ProductQueryReqVO;
import com.flyduck.mall.pms.h5.vo.H5ProductRespVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @program: vueshop
 * @description:
 * @author: flyduck
 * @create: 2024-05-18 21:42
 **/
@RestController
@RequestMapping("/h5/product")
public class H5ProductController extends BaseController {

    @Resource
    private H5ProductService h5ProductService;

    @GetMapping("/getProductPage")
    public R<Page<H5ProductRespVO>> getProductPage(H5ProductQueryReqVO h5ProductQueryReqVO){
        Page<H5ProductRespVO> appProductRespVOPage = h5ProductService.getProductPage(getPage(), h5ProductQueryReqVO);
        return R.ok(appProductRespVOPage);
    }

    @GetMapping("/getProductDetailsById/{id}")
    public R<H5ProductDetailsRespVO> getProductDetailsById(@PathVariable("id") Long id){
        H5ProductDetailsRespVO h5ProductDetailsRespVO =  h5ProductService.getProductDetailsById(id);
        return R.ok(h5ProductDetailsRespVO);
    }
}
